package com.myblog.mapper;

import com.myblog.model.FriendLink;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface FriendLinkMapper {

    @Select("select * from friendlink order by id desc")
    List<FriendLink> selectAllFriend();

    //判断友链是否已经存在
    FriendLink selectFriendLinkIsExist(FriendLink friendLink);

    //更新友链
    void updateFriendLink(FriendLink friendLink);

    //新增友链
    @Insert("insert  into friendlink(blogger,url) values (#{blogger},#{url})")
    void addFriendLink(FriendLink friendLink);

    //删除友链
    @Delete("delete from friendlink where id = #{id}")
    void deleteFriendLinkByIdDao(Integer id);
}
